/**
 *  污染源数据造假识别-五芒星检验
 *  Created by dinghh on 2018/7/13.
 */
'use strict';
angular.module("MetronicApp").directive('testPentacle', function () {
    return {
        scope: {
            id: "@",
            data: "="
        },
        restrict: 'EA',
        template: '<div style="height:300px;width:350px;margin: 0 auto;"></div>',
        replace: true,
        link: function ($scope, element, attrs, controller) {
            function getOption(data) {
                var option = {
                    radar: {
                        name: {
                            textStyle: {
                                color: '#808080',
                                borderRadius: 3,
                                padding: [3, 5]
                            }
                        },
                        indicator: [
                            { name: '超标检验', max: 100},
                            { name: '波动检验', max: 100},
                            { name: '箱体检验', max: 100},
                            { name: '零值检验', max: 100},
                            { name: '工况检验', max: 100}
                        ]
                    },
                    series: [{
                        type: 'radar',
                        data : [
                            {
                                value : [70, 85, 58, 62, 85]
                            }
                        ],
                        itemStyle:{
                            normal:{
                                color: '#87CEFA'          //节点颜色

                            }
                        },
                        lineStyle:{
                            color:'#87CEFA'     //线条颜色
                        }
                    }]
                };
                return option;
            }
            $scope.$watch('data', function (newVal, oldVal) {
                var myChart = echarts.init(document.getElementById($scope.id), 'macarons');
                myChart.setOption(getOption(newVal));
            });
        }
    };
});
